package thread;

// wait和notify

public class Demo12 {
    public static void main(String[] args) {
        Object o = new Object();
        System.out.println("wait 之前");
        synchronized (o) { // 注意加锁对象和wait对象保持一致
            try {
                o.wait();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println("wait 之后");
    }
}
